﻿using System.Data.Entity;

namespace EFCore7.Migrations.Seed;

public class PostSeedAction : ISeedAction
{
    public int Order { get; private set; }

    public PostSeedAction()
    {
        Order = 2;
    }

    public void Action(DbContext context)
    {
        var posts = new List<Biz_Post>
        {
           new Biz_Post { PostId = 1, BlogId = 1, Title = "Seed 1", Content = "Lorem ipsum dolor sit amet", Rating = 5 },
           new Biz_Post { PostId = 1, BlogId = 1, Title = "Seed 2", Content = "Lorem ipsum dolor sit amet", Rating = 5 },
        };
        var postEntities = context.Set<Biz_Post>();
        postEntities.AddRange(posts);
        context.SaveChanges();
    }
}